package com.MSofLectures;

import org.hibernate.SessionFactory;

import com.MSofLectures.Tool.DatabaseControler;
import com.opensymphony.xwork2.ActionSupport;

public class DatabaseBasic extends ActionSupport {
	private static final long serialVersionUID = 1L;
	/**
	 * @Title DatabaseBasic.java
	 * @Package com
	 * @author ufo
	 * 这个包用来进行数据持久化以及处理一些和业务逻辑相关的读写
	 */

	private static SessionFactory sf;
	protected DatabaseControler databaseControler;

	public DatabaseControler getDatabaseControler() {
		if(null==this.databaseControler)
			this.databaseControler=new DatabaseControler(DatabaseBasic.sf);
		return this.databaseControler;
	}
	public void setDatabaseControler(DatabaseControler databaseControler) {
		this.databaseControler = databaseControler;
	}

	public void finalize() throws Throwable{
		this.databaseControler.finalize();
		super.finalize();
	}
	public static SessionFactory getSf() {
		return sf;
	}
	public static void setSf(SessionFactory sf) {
		DatabaseBasic.sf = sf;
	}
}
